<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<%
if(Session("passed")!=null&&Session("passed"))
{
	var operation=Request.Form("operation");

	if(operation=="addupdate")
	{
		var stu_id=Request.Form("stu_id");
		var stu_phone=Request.Form("stu_phone");
		var stu_phone2=Request.Form("stu_phone2");
		var stu_qq=Request.Form("stu_qq");
		var stu_email=Request.Form("stu_email");
		var stu_company=Request.Form("stu_company");
		var stu_locat=Request.Form("stu_locat");
		
		var sql="select * from stuinfo where stu_id='"+stu_id+"'";
		var rs=Server.CreateObject("adodb.recordset");
		if(stu_id!=null && stu_phone!=null && stu_qq!=null && stu_email!=null && stu_company!=null && stu_locat!=null)
		{
			rs.open(sql,conn,1,3);
			if(rs.RecordCount==0)
			{
				rs.AddNew();
				rs("stu_id")=stu_id;
				rs("stu_phone")=stu_phone;
				rs("stu_phone2")=stu_phone2;
				rs("stu_qq")=stu_qq;
				rs("stu_email")=stu_email;
				rs("stu_company")=stu_company;
				rs("stu_locat")=stu_locat;
				rs.Update();
			}
			else
			{
				rs("stu_phone")=stu_phone;
				rs("stu_phone2")=stu_phone2;
				rs("stu_qq")=stu_qq;
				rs("stu_email")=stu_email;
				rs("stu_company")=stu_company;
				rs("stu_locat")=stu_locat;
				rs("stu_modify")=new Date().getVarDate();
				rs.Update();
			}
			Response.Write("done=ok");
		}
		else
		{
			Response.Write("done=false");
		}
		
		rs.close();
		delete rs;
		conn.close();
		delete conn;
	}
	else if(operation=="select")
	{
		var stu_id=Request.Form("stu_id");
		
		var rs=Server.CreateObject("adodb.recordset");
		var sql="select stu_phone,stu_phone2,stu_qq,stu_email,stu_company,stu_locat from stuinfo where stu_id='"+stu_id+"'";
		rs.open(sql,conn,1);
		Response.Write("<?xml version='1.0' encoding='utf-8'?>");
		Response.Write("<info>");
		if(rs.RecordCount==1)
		{
			rs.MoveFirst();
			Response.Write("<stuphone>"+rs("stu_phone")+"</stuphone>");
			if(rs("stu_phone2")==null||rs("stu_phone2")==""||String(rs("stu_phone2"))=="null")
			{
				Response.Write("<stuphone2/>");
			}
			else
			{
				Response.Write("<stuphone2>"+rs("stu_phone2")+"</stuphone2>");
			}
			Response.Write("<stuqq>"+rs("stu_qq")+"</stuqq>");
			Response.Write("<stuemail>"+rs("stu_email")+"</stuemail>");
			Response.Write("<stucompany>"+rs("stu_company")+"</stucompany>");
			Response.Write("<stulocat>"+rs("stu_locat")+"</stulocat>");
		}
		Response.Write("</info>");
		
		rs.close();
		delete rs;
		conn.close();
		delete conn;
	}
}
else
{
	Response.Write("<?xml version='1.0' encoding='utf-8'?>");
	Response.Write("<!--you need login the system first-->");
	Response.Write("<recordes/>");
}
%>